//
//  Basic3DAnimationViewController.m
//  TotalDemo
//
//  Created by gujian on 16/5/18.
//  Copyright © 2016年 gujian. All rights reserved.
//

#import "Basic3DAnimationViewController.h"
#import "BasicAnimationView.h"

@interface Basic3DAnimationViewController ()

@end

@implementation Basic3DAnimationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"动画基础";
    [self addSubViews];
}

- (void)addSubViews
{
    CGFloat margin = 20.0;
    CGFloat itemWidth = (SCREEN_WIDTH - 4 * margin)/3.0;
    
    NSArray *transFrom = @[@(BasicTransformX),@(BasicTransformY),@(BasicTransformZ),@(BasicTransformX|BasicTransformY),@(BasicTransformX|BasicTransformZ),@(BasicTransformY|BasicTransformZ),@(BasicTransformX|BasicTransformY|BasicTransformZ)];
    
    CGFloat offX = margin;
    CGFloat offY = margin;
    for (int i = 0; i < 7; i++) {
        
        if (offX >= (SCREEN_WIDTH-margin)) {
            offY += (itemWidth + margin);
            offX = margin;
        }
        
        CGRect frame = CGRectMake(offX, offY, itemWidth, itemWidth);
        BasicAnimationView *view = [[BasicAnimationView alloc] initWithFrame:frame BasicTransform:[transFrom[i] integerValue]];
        view.backgroundColor = [UIColor randomColor];
        [self.view addSubview:view];
        offX += (margin + itemWidth);
    }
    
}


@end
